<?php
/**
 * Created By Project
 * Author: 陈东
 * Copyright：陈东
 * Source Code：陈东
 * Explain：I shall not authorize for any other commercial purposes, law breakers must be prosecuted.
 */
namespace Home\Widget;
use Think\Controller;
class JgwardWidget extends Controller {

	//根据奖品ID查询奖品信息
	public function getaward($id,$field){
		$award = D(C('TABLE_AWARD'));
		$res = $award->where(array('id'=>$id))->find();
		if($res){
			echo $res[$field];
		}
	}
	//获取奖品领取状态
	public function awardstatus($id,$f=null){
		$applys = D(C('TABLE_APPLYS'));
		$res = $applys->where(array('id'=>$id))->find();
		if($res){
			if($res['status']==1){
				if(empty($f)){
					echo '已领取';
				}
			}else{
				if(!empty($f)){
					echo "<a class=\"setstatus\" v='".$id."'>确认领取</a>";
				}else{
					echo '未领取';
				}
			}
		}else{
			if(!empty($f)){
				echo "<a class=\"setstatus\" v='\".$id.\"'>确认领取</a>";
			}else{
				echo '未领取';
			}
		}
	}
	//根据奖品ID查询开奖时间
	public function getawardtime($id,$field){
		$applytime= D(C('TABLE_APPLYTIME'));
		$res = $applytime->where(array('awardid'=>$id))->find();
		if($res){
			echo $res[$field];
		}
	}

}
?>